package com.mobiletrain.org.motherkitch.sliding;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import com.mobiletrain.org.motherkitch.R;
import com.mobiletrain.org.motherkitch.sliding.caipu.Caipu;

public class CaipuDetaiActivity extends ActionBarActivity {

    private Toolbar mTitle;
    private TextView name;
    private TextView dshort;
    private TextView dMater;
    private TextView dStep;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_caipu_detai);
        initBar();
        findById();
        Intent intent = getIntent();
        Caipu bean = (Caipu) intent.getSerializableExtra("bean");
        name.setText(bean.getName());
        dshort.setText(bean.getSmsg());
        dMater.setText(bean.getMaterial());
        dStep.setText(bean.getMake());

    }

    public void findById() {
        name = (TextView) findViewById(R.id.d_name);
        dshort = (TextView) findViewById(R.id.d_short);
        dMater = (TextView) findViewById(R.id.d_mater);
        dStep = (TextView) findViewById(R.id.d_step);
    }

    public void initBar() {
        mTitle = (Toolbar) findViewById(R.id.detail_title);
        setSupportActionBar(mTitle);
        mTitle.setNavigationIcon(R.drawable.back);
        mTitle.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CaipuDetaiActivity.this.finish();
            }
        });

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_caipu_detai, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
